package com.rajaev.dtu.tractor.infrastructure.base.enums;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public enum SnotiEventType {
    ONLINE("device_online", "上线"),
    OFFLINE("device_offline", "下线"),
    KV("device_status_kv", "数据点"),
    GPS_KV("device_gps_kv","定位信息"),
    FAULT("attr_fault","故障信息"),
    ALERT("attr_alert","故障告警"),
    LBS_KV("device_lbs_kv","")

    ;

    private String code;

    private String desc;

    SnotiEventType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static SnotiEventType getType(String eventType){
        for (SnotiEventType notiReqPushEvents : SnotiEventType.values()) {
            if (notiReqPushEvents.getCode().equalsIgnoreCase(eventType)) {
                return notiReqPushEvents;
            }
        }
        log.error("error eventType:{}",eventType);
        return null;
    }
}
